package cn.iocoder.lw.module.core.controller.admin.device.vo;

import com.mzt.logapi.starter.annotation.DiffLogField;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotNull;
import jakarta.validation.constraints.Size;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;

import java.time.LocalDateTime;

import static cn.iocoder.lw.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;

@Schema(description = "管理后台 - 核心设备新增/修改 Request VO")
@Data
public class CoreDeviceSaveReqVO {

    @Schema(description = "设备编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024")
    private Long id;

    @Schema(description = "项目编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
    @DiffLogField(name = "项目编号")
    @NotNull(message = "项目编号不能为空")
    private Long projectId;

    @Schema(description = "设备类型", requiredMode = Schema.RequiredMode.REQUIRED, example = "智能门锁")
    @DiffLogField(name = "设备类型")
    @Size(max = 50, message = "设备类型长度不能超过50个字符")
    private String deviceType;

    @Schema(description = "设备ID（关联商品SPU的ID）", requiredMode = Schema.RequiredMode.REQUIRED, example = "1001")
    @DiffLogField(name = "设备ID")
    @NotNull(message = "设备ID不能为空")
    private Long spuId;

    @Schema(description = "设备名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "智能门锁A-001")
    @DiffLogField(name = "设备名称")
    @Size(max = 100, message = "设备名称长度不能超过100个字符")
    private String deviceName;

    @Schema(description = "设备数量", requiredMode = Schema.RequiredMode.REQUIRED, example = "10")
    @DiffLogField(name = "设备数量")
    @NotNull(message = "设备数量不能为空")
    private Integer deviceCount;
 
    @Schema(description = "质保有效开始时间", requiredMode = Schema.RequiredMode.REQUIRED)
    @DiffLogField(name = "质保有效开始时间")
    @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
    private LocalDateTime warrantyStartTime;

    @Schema(description = "质保有效结束时间", requiredMode = Schema.RequiredMode.REQUIRED)
    @DiffLogField(name = "质保有效结束时间")
    @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
    private LocalDateTime warrantyEndTime;

    @Schema(description = "设备状态", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
    @DiffLogField(name = "设备状态")
    private Integer status;

    @Schema(description = "设备位置描述", example = "一楼大厅")
    @DiffLogField(name = "设备位置描述")
    @Size(max = 200, message = "设备位置描述长度不能超过200个字符")
    private String location;

    @Schema(description = "设备编码", example = "DL-001")
    @DiffLogField(name = "设备编码")
    @Size(max = 50, message = "设备编码长度不能超过50个字符")
    private String deviceCode;

    @Schema(description = "安装时间")
    @DiffLogField(name = "安装时间")
    @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
    private LocalDateTime installTime;

    @Schema(description = "备注", example = "设备运行正常")
    @DiffLogField(name = "备注")
    @Size(max = 500, message = "备注长度不能超过500个字符")
    private String remark;
    
    
    @Schema(description = "质保剩余天数", requiredMode = Schema.RequiredMode.REQUIRED)
    private Integer warrantyDaysRemaining;
 
    @Schema(description = "是否所有者", requiredMode = Schema.RequiredMode.REQUIRED)
    private Boolean isOwner; 
    
    @Schema(description = "只能拥有者能看", requiredMode = Schema.RequiredMode.REQUIRED)
    private Boolean onlyOwner;    
}